package resoft.jeasyform.core;

import java.util.Map;
import java.util.HashMap;

/**
 * <p>the container save some session data.it's a singleton</p>
 * User: albert
 * Date: Aug 30, 2007
 * Time: 1:57:37 AM
 */
public class Session {
    private static Session instance = new Session();
    private Session() {
    }

    /**
     * get the single instance
     *
     * @return Session
     * */
    public static Session getInstance() {
        return instance;
    }

    /**
     * set a value
     *
     * @param key String
     * @param value Object
     * */
    public void set(String key,Object value) {
        attributes.put(key,value);
    }

    /**
     * get value by key.return null if not exists
     *
     * @param key String
     * @return Object
     * */
    public Object get(String key) {
        return attributes.get(key);
    }

    private Map attributes = new HashMap();
}
